/* eslint-disable */
'use strict'

module.exports = (req, res, uuid, result) => {
  if ( !req || !res || !uuid) {
    return null
  }
  req.session.flag = result.flag //标示哪个用户
  req.session.uuid = uuid
  req.session.mobile = req.body.mobile 
  res.cookie('uuid', uuid)
  res.cookie('mobile', req.body.mobile, { expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)})
  res.cookie('password', req.body.password, { expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30) })
  //注册时有许可码的为管理员 其它为一般操作员
  console.log(result.code === null)
  // result && result.code !== null ? res.cookie('admin', '1') : res.cookie('admin', '0')
  result.code === null ? res.cookie('admin', '0') : res.cookie('admin', '1')
}
